<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="/yingji/Public/assets/css/bs3/dpl.css" rel="stylesheet" type="text/css" />
<link href="/yingji/Public/assets/css/bs3/bui.css" rel="stylesheet" type="text/css" />
<link href="/yingji/Public/assets/css/style.css" rel="stylesheet" type="text/css" />
<link href="/yingji/Public/assets/uploadify/uploadify.css" rel="stylesheet" type="text/css">
<style type="text/css">

#tabbox {
	width:70%;
	overflow:hidden;
	margin:0 auto;
}

.tabs {
	width: 100%;
	height: 32px;
	margin-bottom:10px;
	margin-top:20px;
}

.tabs li {
	float:left;
	height:31px;
	line-height:31px;
	border:1px solid #204077;
	border-left:none;
	margin-bottom: -1px;
	overflow: hidden;
	position: relative;
	border-radius:5px;
	margin:0px 5px;
}

.tabs li a {
	display: block;
	padding: 0 20px;
	background:#428bca;
	color:#fff;
	text-decoration:none;
}

.tabs .thistab a,.tabs .thistab a:hover,.tabs .thistab a:active {
	background:#fff;
	color:#428bca;
	text-decoration:none;
}

.tab_conbox {
	border: 1px solid #EAEAEA;
	height:auto;
	overflow:hidden;
}

.tab_con {
	padding:12px;
	font-size: 14px;
	line-height:175%;
}

.staff ul{
	float:left;
	width:100%;
	margin:20px auto;
	height:auto;
	overflow:hidden;
}

.staff li{
	float:left;
	margin:5px 20px;
	width:150px;
	height:30px;
	line-height:30px;
	color:#fff;
	font-weight:bold;
	list-style:none;
}

.staff li a:active{
	text-decoration:none;
	color:#357ebd;
}

.control-group {
	margin-top:20px;
	width:100;
}

.control-group .control-label{
	display:inline-block;
}

.control-group controls{
	float:left;
}

.hint h4{
	margin:10px auto;
}

.hint ul{
	width:100%;
}

.hint ul li {
	display:inline-block;
	margin:0px 10px;
	height:40px;
	line-height:40px;
	color:#fff;
}

</style>
<script type="text/javascript" src="/yingji/Public/assets/js/jquery-1.8.1.min.js"></script>
</head>
<body>
<script language="javascript">

var winID = null;
function openFullWindow(url,winname){
	var strFeatures = "left=0,screenX=0,top=0,screenY=0";  
	if (window.screen){
		var maxh = screen.availHeight-30;
		var maxw = screen.availWidth-10;
		strFeatures += ",height="+maxh;
		strFeatures += "innerHeight"+maxh;
		strFeatures += ",width="+maxw;
		strFeatures += "innerwidth"+maxw;
	}else{
		strFeatures +=",resizable"; 
	}
	winID = window.open(url,winname,strFeatures);
}

</script>

<div class="demo-content" style="margin-top:1%;">
    <div class="row" style="margin-left:10px;">
		<div style="text-align:center"><h2><?php echo ($scripts["scriptsname"]); ?> - 演练签到</h2><hr></div>
        <div id="tabbox">
			<a class="button button-primary" onClick="window.location.reload();" style="margin-bottom:10px;">刷新本页</a>
			<a class="button button-primary" onClick="openFullWindow('<?php echo U('Home/Scripts/signin',array('did' =>I('get.did'),'sid'=>I('get.sid')));?>','JS');" style="margin-bottom:10px;">主屏显示</a>
            <div class="hint">
            	<h4>操作提示</h4>
                <ul>
                	<li>1、点击选择参与部门</li>
                    <li>2、输入参与部门人员</li>
                    <li>3、保存参与部门人员</li>
                </ul>
            </div>
            <ul class="tabs" id="tabs">
				<?php if(is_array($department)): $k = 0; $__LIST__ = $department;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($k % 2 );++$k;?><li><a href="<?php echo U('Home/Scripts/signin', array('did'=>$k,'sid'=>I('get.sid')));?>"><?php echo ($vo); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
			</ul>
            
            <form id="J_Form" action="<?php echo U('Home/Record/add');?>" class="form-horizontal registerform" method="post" enctype="multipart/form-data">
            <ul class="tab_conbox" id="tab_conbox">
            <?php if(is_array($department)): $k = 0; $__LIST__ = $department;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($k % 2 );++$k;?><li class="tab_con">
                	<div id="panel" class="" style="padding:10px;">
                    	<input name="uid" type="hidden" value="<?php echo session(C('AUTH_KEYS'));?>">
                        <input name="mid" type="hidden" value="<?php echo session('gid');?>">
                        <input name="sid" type="hidden" value="<?php echo I('get.sid');?>">
                        <input name="pid" type="hidden" value="<?php echo ($pid); ?>">
                        <input name="title" type="hidden" value="<?php echo ($scripts["scriptsname"]); ?>演练记录<?php echo ($pid); ?>">
                        <input name="staff[<?php echo ($k); ?>][department]" type="hidden" value="<?php echo ($vo); ?>">
                        <div class="control-group">
							<label class="control-label"><?php echo ($vo); ?></label>
							<div class="controls">
                                <input type="text" name="staff_add" id="add_<?php echo ($k); ?>" style="width:400px; margin-right:10px;" />
								<span class="button button-primary" id="btnAdd_<?php echo ($k); ?>">签到</span>
							</div>
						</div>
                        <div id="staff_<?php echo ($k); ?>" class="staff"><ul></ul></div>
                    </div>
<script type="text/javascript">
	$('#btnAdd_<?php echo ($k); ?>').on('click',function(){
		var did = <?php echo ($k); ?>;
		var d = $('#add_<?php echo ($k); ?>').val();
		var obj = {'text':d,value:d};
		$("#add_<?php echo ($k); ?>").attr("value",'');
		$("#staff_<?php echo ($k); ?> ul").append('<li id="con_<?php echo ($k); ?>" class="con" onclick="this.remove()">'+d+'&nbsp;&nbsp;<span style="float:right; cursor:pointer; color:#fff; font-weight:normal;">删除</span></li><input type="hidden" name="staff[<?php echo ($k); ?>][staff][]" value="'+d+'">');
	});
</script>
                </li><?php endforeach; endif; else: echo "" ;endif; ?>
            </ul>
            <div class="row actions-bar">
				<div class="form-actions">
					<button type="submit" class="button button-primary" href="javascript:void(0)">进入演练</button>
					<button type="button" class="button button-primary" name="backid" id="backid">取消</button>
                	<span id="msgdemo2"></span>
				</div>
			</div>
            </form>
    	</div>
    </div>        	
</div>	
<script type="text/javascript" src="/yingji/Public/assets/js/jquery.SuperSlide.js"></script>
<script type="text/javascript" src="/yingji/Public/assets/js/config.js"></script>
<script type="text/javascript" src="/yingji/Public/assets/js/bui.js"></script>
<script type="text/javascript" src="/yingji/Public/assets/js/Validform_v5.3.2_min.js"></script>
<script type="text/javascript">

	$(document).ready(function() {
		jQuery.jqtab = function(tabtit,tab_conbox,shijian) {
			$(tab_conbox).find("li").hide();
			$(tabtit).find("li:first").addClass("thistab").show(); 
			$(tab_conbox).find("li:first").show();
		
			$(tabtit).find("li").bind(shijian,function(){
			  $(this).addClass("thistab").siblings("li").removeClass("thistab"); 
				var activeindex = $(tabtit).find("li").index(this);
				$(tab_conbox).children().eq(activeindex).show().siblings().hide();
				return false;
			});
		
		};
		$.jqtab("#tabs", "#tab_conbox", "click");	
	});
	
	BUI.use('bui/form', function (Form) {
        new Form.Form({
            srcNode:'#J_Form'
        }).render();
    });
	
	$(function(){
		$(".registerform").Validform({
			tiptype:function(msg,o,cssctl){
				var objtip=$("#msgdemo2");
				cssctl(objtip,o.type);
				objtip.text(msg);
			},
			ajaxPost:true,
			callback:function(data){
				if(data.status == 'y'){
				<?php echo session('open_j',1);?>
				<?php echo session('open_j_sid',I('get.sid'));?>
				<?php echo session('open_j_pid',$pid);?>
				window.open("<?php echo U('Index/index');?>#scripts/scripts");
					/*top.topManager.openPage({
						id:'drill',
						title:'演练前奏',
						href:'<?php echo U("Scripts/drill",array("sid"=>I("get.sid"),"pid"=>$pid));?>',
						isClose:true,
						reload:true,
					});*/
				}
			},
		});
	});
	
	$(function () {       
		$('#backid').click(function(){
			top.topManager.openPage({
				id:'scripts',
				title:'脚本管理',
				href:'<?php echo U("Scripts/index");?>',
				isClose:true,
				reload:true,
			});
		 });
    });
</script>
</body>
</html>